using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace Barbar.MapReport.HtmlRender.Handlers {
  internal class PageHandler : ISimpleHttpHandler {
    #region ISimpleHttpHandler Members

    public void ProcessRequest(HttpContext context) {
      Guid guid = new Guid(context.Request["id"]);
      context.Response.ContentType = "text/html";
      string result;
      try {
        context.Application.Lock();
        result = (string)context.Cache[guid.ToString("N")];
      }
      finally {
        context.Application.UnLock();
      }
      if (String.IsNullOrEmpty(result))
        context.Response.Write("Cache expired.");
      else
        context.Response.Write(result);
    }

    #endregion
  }
}
